package Presentacion.Vehiculo;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;

import java.awt.Font;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JSeparator;

public class VehiculoAyuda extends JDialog {

	private final JPanel contentPanel = new JPanel();

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			VehiculoAyuda dialog = new VehiculoAyuda();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public VehiculoAyuda() {
		this.eventoTeclado();
		
		setBounds(100, 100, 460, 290);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);
		
		JLabel lblDatosDeVehiculo = new JLabel("Datos del veh\u00EDculo");
		lblDatosDeVehiculo.setFont(new Font("Tahoma", Font.BOLD, 14));
		lblDatosDeVehiculo.setBounds(10, 10, 154, 22);
		contentPanel.add(lblDatosDeVehiculo);
		
		JSeparator separator = new JSeparator();
		separator.setBounds(10, 35, 456, 5);
		contentPanel.add(separator);
		
		JLabel lblPatente = new JLabel("Patente:");
		lblPatente.setBounds(10, 45, 210, 14);
		contentPanel.add(lblPatente);
		
		JLabel lblSoloYNumeros = new JLabel("Formato de patente v\u00E1lida, tres letras seguido de tres n\u00FAmeros");
		lblSoloYNumeros.setBounds(50, 65, 416, 14);
		contentPanel.add(lblSoloYNumeros);
		
		JLabel lblColor = new JLabel("Color:");
		lblColor.setBounds(10, 105, 210, 14);
		contentPanel.add(lblColor);
		
		JLabel lblcolorDelV = new JLabel("Color del veh\u00EDculo, Ej: rojo, verde, negro, etc.");
		lblcolorDelV.setBounds(50, 125, 416, 14);
		contentPanel.add(lblcolorDelV);
		
		JLabel lblAnoDelVehiculo = new JLabel("Modelo o a\u00F1o que fue comprado el veh\u00EDculo.");
		lblAnoDelVehiculo.setBounds(50, 165, 285, 14);
		contentPanel.add(lblAnoDelVehiculo);
		
		JLabel lblAno = new JLabel("A\u00F1o del veh\u00EDculo:");
		lblAno.setBounds(10, 145, 210, 14);
		contentPanel.add(lblAno);
		
		JLabel lblMarcaModeloTipo = new JLabel("Marca, Modelo y Tipo: ");
		lblMarcaModeloTipo.setBounds(10, 185, 210, 14);
		contentPanel.add(lblMarcaModeloTipo);
		
		JLabel lblmarcamodelotipov = new JLabel("Marca, Modelo y tipo de veh\u00EDculo. Ej: Marca - Fort; Modelo - K,");
		lblmarcamodelotipov.setBounds(50, 205, 416, 14);
		contentPanel.add(lblmarcamodelotipov);
		
		JLabel lblSinEspacios = new JLabel("sin espacios: AAA999. Ej: ABC123, QWE987, ZXC456, etc.");
		lblSinEspacios.setBounds(50, 85, 416, 14);
		contentPanel.add(lblSinEspacios);
		
		JLabel lblTipoAuto = new JLabel("Tipo - Auto, etc.");
		lblTipoAuto.setBounds(50, 225, 416, 14);
		contentPanel.add(lblTipoAuto);
		
		this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		this.setVisible(true);
		
		this.setLocationRelativeTo(null);
		
		
		
	}
	
	public void cerrar(){
		this.dispose();
	}
	
	 private void eventoTeclado() {
		 /** evento escape*/
			        KeyListener keyListenerEscape = new KeyAdapter() {
			            public void keyPressed(KeyEvent evt) {
			                if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) {
			                	System.out.println("ESCAPE");
			                	cerrar();
			               }
			            }
			        };
		/** evento enter*/
			        KeyListener keyListenerEnter = new KeyAdapter() {
			            public void keyPressed(KeyEvent evt) {
			                if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
			                	System.out.println("ENTER");
			                	cerrar();
			                }
			            }
			        };
	
			        
		/**ASIGNO EVENTOS TECLADO*/
		//FIN EVENTOS CON ESCAPE
			        this.addKeyListener(keyListenerEscape);
		//EVENTOS CON ENTER			       
			        this.addKeyListener(keyListenerEnter);			      
		//FIN EVENTOS CON ENTER    
	}
}
